using System;
using Microsoft.WowAddonStudio.FrameXml.Editor.Test.Properties;
using Microsoft.WowAddonStudio.Services;

namespace Microsoft.WowAddonStudio.FrameXml.Editor.Test.Mocks
{
	public class MockWowLocatorService : IWowLocatorService
	{
		private readonly string wowPath;

		/// <summary>
		/// Initializes a new instance of the <see cref="MockWowLocatorService"/> class.
		/// </summary>
		public MockWowLocatorService()
		{
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="MockWowLocatorService"/> class.
		/// </summary>
		/// <param name="wowPath">The wow path.</param>
		public MockWowLocatorService(string wowPath)
		{
		    if (wowPath == null) 
                throw new ArgumentNullException("wowPath");

		    this.wowPath = wowPath;
		}

	    /// <summary>
        /// Gets a value indicting whether a World of Warcraft installation was detected.
        /// </summary>
        /// <value></value>
	    public bool IsWowInstalled
	    {
	        get { return true; }
	    }

	    /// <summary>
		/// Gets the base path to the World of Warcraft installation.
		/// </summary>
		/// <returns>The base path to World of Warcraft.</returns>
		public string GetWowBasePath()
		{
			if (String.IsNullOrEmpty(wowPath))
				return Settings.Default.WowBasePath;
			
			return wowPath;
		}

		/// <summary>
		/// Gets the latest World of Warcraft Interface version.
		/// </summary>
		/// <returns>
		/// The latest World of Warcraft interface version.
		/// </returns>
		public string GetWowInterface()
		{
			return "20400";
		}
	}
}